...

View Full Version : Textbox.value create Link



Nogi
12-15-2004, 10:20 AM
Hi all.

I'm pretty new at scripting in general, and wonder if anyone could help me with something i'm trying to achief.

I have an .html page, that contains several textboxes. Their values are dynamic, since they are being called from a server.

One of these textboxes containes a relative url (displayed as text).
Next to it i have an onclick-button.

What i'm searching for is a script for the onclick-button, to launch the textbox.value as URL.

Textboxname : Textboxfield
Onlick-button name : Launchlink

Ex.:

Textbox displays the value: document/start.pdf
Clicking the button will launch the relative hyperlink document/start.pdf

I don't think this can be to hard to achieve, but trying out some scripts i found on the net made me realize i'm far from being an expert in these things.

Thanks in advance for any help

Kor
12-15-2004, 10:32 AM
Try this kinda:


<form>
<input name="Textboxfield" type="text" value="document/start.pdf"><br>
<input name="Launchlink" type="button" value="Launch link" onclick="location.href=this.form.elements['Textboxfield'].value">
</form>

Nogi
12-15-2004, 10:50 AM
Thanks already for your very fast reply. The only thing is, the textboxfield value is variable.

So the document/start.pdf was just an example. This value changes together with some other fields depending on a users' selection.

Is there any way to make the textboxfield.value in your script variable?

(by the way, it should run in html... is there any chance you could change it into a javascript code?)

Regards & many thanks in advance

Kor
12-15-2004, 10:53 AM
But it is variable. If user will insert another URL in textbox, the button will open the new input value (even I think this is not your intention). Could you detail your problem, please?

Nogi
12-15-2004, 10:58 AM
Look, this is the piece of code on my page that generates the textboxfield:

</SPAN><TEXTAREA class=MsoTextbox id=textboxfield style="LEFT: 1.125in; WIDTH: 154px; POSITION: absolute; TOP: 0.792in; HEIGHT: 17px" tabIndex=18 name=txtlink rows=1 MsoTextAlign="General"></TEXTAREA>

The whole page has been designed in microsoft access (maybe that's why the code looks so wierd heh).

This represents the code of the button to click on:

</SUP><BUTTON id=Command0
style="Z-INDEX: 1; LEFT: 2.917in; WIDTH: 1in; POSITION: absolute; TOP: 0.75in; HEIGHT: 0.25in"
tabIndex=19 name=formname MsoTextAlign="General">Command0</BUTTON>

Now, i don't know how to add your code to both of these in order to make it work to be honest heh..

Could you help me out maybe?

Kor
12-15-2004, 12:09 PM
Something like:

<BUTTON id=Command0
style="Z-INDEX: 1; LEFT: 2.917in; WIDTH: 1in; POSITION: absolute; TOP: 0.75in; HEIGHT: 0.25in"
tabIndex=19 name=formname MsoTextAlign="General" onclick="location.href=document.getElementById('textboxfield').value">Command0</BUTTON>

Nogi
12-15-2004, 02:06 PM
Hey Kor, thanks again for your help.

Well the code you just gave me worked, if i gave the textbox an absolute value, like this:

</SPAN><TEXTAREA class=MsoTextbox id=textboxfield style="LEFT: 1.125in; WIDTH: 154px; POSITION: absolute; TOP: 0.792in; HEIGHT: 17px" tabIndex=18 name=txtlink rows=1 MsoTextAlign="General">www.codingforums.com</TEXTAREA>

When i leave it blank (as it originaly was), it loads something, but it goes so fast i can't see what it loads, and then it gives a "page cannot be found"-error.

Could it be there's also a piece of code needed for the textbox-part? Or maybe something is overlooked?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum