Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 17th, 2005, 6:41 PM   #1
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Exclamation Java Script Button

what is the code for a button with a link in java script?

Last edited by crawforddavid2006; Jun 17th, 2005 at 9:46 PM. Reason: typo
crawforddavid2006 is offline   Reply With Quote
Old Jun 17th, 2005, 9:46 PM   #2
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Is it even possible to make a button with a hyperlink in java script?
crawforddavid2006 is offline   Reply With Quote
Old Jun 18th, 2005, 12:50 AM   #3
CrAzY_J
Newbie
 
Join Date: May 2005
Posts: 29
Rep Power: 0 CrAzY_J is on a distinguished road
Send a message via MSN to CrAzY_J
<script type='text/javascript'>
var iP=document.createElement('input');
iP.setAttribute('type','button');
iP.setAttribute('value','Rawr');
iP.onClick=iHateU();
function iHateU(){
document.location="www.pr0n.com";
}
document.body.appendChild(iP);
</script>
CrAzY_J is offline   Reply With Quote
Old Jun 25th, 2005, 11:15 AM   #4
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Will that run? iHateU() isn't defined 'till after it is referenced?
Cerulean is offline   Reply With Quote
Old Jun 25th, 2005, 3:06 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It won't.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jun 26th, 2005, 8:12 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I didn't evaluate that code for workability. Javascript functions do not have to be declared before they're referenced. They DO have to be declared before they're invoked.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 27th, 2005, 9:39 AM   #7
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
*nods*
Cerulean is offline   Reply With Quote
Old Jun 27th, 2005, 10:24 AM   #8
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I would personally just do this:
<form action="http://www.example.com/" method="post">
    <div><input type="submit" value="Go!" /></div>
</form>
__________________
Me :: You :: Them

Last edited by Ooble; Jun 27th, 2005 at 4:01 PM.
Ooble is offline   Reply With Quote
Old Jun 28th, 2005, 12:49 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Quote:
Originally Posted by Ooble
I would personally just do this:
<form action="http://www.example.com/" method="post">
    <div><input type="submit" value="Go!" /></div>
</form>
Hello? Do I not get credit for anything? :p
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jun 28th, 2005, 2:33 PM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
We didn't give you credit because you put a div, to no purpose, around just the button! :p
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC