Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

HTML troubleshooting

HTML

  • Please log in to reply
3 replies to this topic

#1 ccc123d

ccc123d

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 March 2012 - 05:36 PM

I wrote this to make a button do two things. One is to set a cookie and the other is to send the user to a webpage. What am I doing wrong?


<input type="button" onclick="func1(); func2(); >
function func1(){
{onclick="setCookie('inpVal',getFormString(this.form,true));}
function func2(){
{onclick="window.location.href='http://www.csdvds.com'"}
}
  • 0

#2 GabryelFall

GabryelFall

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 72 posts

Posted 13 March 2012 - 02:45 PM

This should prolly go in the javascript section.
  • 0
~~~~>>>><<<<~~~~
Cook to live; Live to cook. Code is poetry. Chef and code-monkey,
Gabe

#3 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 16 March 2012 - 01:39 AM


[COLOR=#333333]<input type="button" onclick="func1(); func2(); > [/COLOR][COLOR=#ff0000][B]Missing closing quote[/B][/COLOR]

[COLOR=#333333]function func1(){[/COLOR]

[B][COLOR=#ff0000][strike]{onclick="[/strike][/COLOR][/B][COLOR=#333333]setCookie('inpVal',getFormString(this.fo rm,true));}[/COLOR]

[COLOR=#333333]function func2(){[/COLOR]

[COLOR=#ff0000][B][strike]{onclick="[/strike][/B][/COLOR][COLOR=#333333]window.location.href='http://www.csdvds.com'[/COLOR][B][COLOR=#ff0000][strike]"[/strike][/COLOR][/B][COLOR=#333333]}[/COLOR]

[COLOR=#333333]}[/COLOR]

I assume the script code is in a <script type="text:javascript"> block.
  • 0

#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 15 April 2012 - 07:02 AM

It should look more like this :

<input type="button" onclick="func1();">

function func1()
{

    setCookie('inpVal',getFormString(this.form,true));
    this.onclick="window.location.href='http://www.csdvds.com'";

}


  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download