Hyperlink with JavaScript

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
McGuywer
Registered User
Posts: 362
Joined: 03 Aug 2004, 02:00
Location: Pretoria

Hyperlink with JavaScript

Post by McGuywer »

Okay,
Now stay with me. I created a Javascript hyperlink that looks like this :<input type="button" value="Home" onclick="location.href='index.html'">.
Okay,
Now I am using frames and I want to know how to open this link in a frame? I looks like a button, but I do not want to use a button (Its slower).
I also do not want to move a way from JS. Any help? :cry:
Aan wat dink jy nie?
Web Africa ADSL
Kronos
Moderator Emeritus
Posts: 4280
Joined: 28 May 2003, 02:00
Location: Azeroth
Contact:

Post by Kronos »

OK, it's quite hard to stay with you, but here goes.

All you need to do is add a

Code: Select all

target="frameName"
to your link. Don't know the exact JS version of this, but that's more or less what you need. Set the target to the Frame where you want it displayed
Image
McGuywer
Registered User
Posts: 362
Joined: 03 Aug 2004, 02:00
Location: Pretoria

Post by McGuywer »

Nope,
I does not work. :(
Aan wat dink jy nie?
Web Africa ADSL
Nicksta
Registered User
Posts: 33
Joined: 23 Mar 2004, 02:00
Location: Cape Town
Contact:

Post by Nicksta »

Eermm...its coming up as a button cos ur saying " input type="button" "...

um, im not a javascript expert, but why not just use the following??
<A HREF="ThePageYouWantToOpen.html" TARGET="TheFrameToOpenItIn">WhatYouWantTheTextToSayInsteadOfAButton</A>
Dunno hey, just a suggestion...[/quote]
Pulse
Registered User
Posts: 12
Joined: 26 Mar 2004, 02:00

Post by Pulse »

or you can use it like this, still use the button, but do this :

Code: Select all


<input type="button" name="mybutton"  value"Redirect" onClick=" document.location.href= 'http://www.mysite.co.za' ; "/>

I've quickly tested this for you and it works,

if you are using frames your JavaScript would look like this :

Code: Select all


parent.leftFrame.location="index.php";
Hope this helps ya

Pulse :twisted:
Nerevar
Registered User
Posts: 3621
Joined: 21 Jul 2004, 02:00
Location: Stellenbosch
Contact:

Post by Nerevar »

Hey McGuywer leave my avatar!!!!!
Image
E6600@2.9GHz, Asus8800 GTS, 2x2GB
Patriot DDR2 4-4-4-12 @ 900MHz
Post Reply