JavaScript link of a string object

We can declare a string and add a hyper link to the string. Here is one simple example of adding a link to a string.
my_string= new String("Welcome to");
We will modify the above code a bit and or change dynamically the associated link of the string by clicking a radio button. You will visit google or Yahoo based on the radio button you clicked.
Here is the code

<title>(Type a title for your page here)</title>
<script type="text/javascript">
function linkme(str){
my_string= new String("Take me to my Search Engine");


<input type=radio name=engine value='Google' onClick="linkme('google')";>Google <input type=radio name=engine value='Yahoo' onClick="linkme('Yahoo')";> Yahoo


Demo of adding link to string

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 All rights reserved worldwide Privacy Policy Disclaimer