Jump to content

Is this possible?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
nitreg

nitreg

    Newbie

  • Members
  • Pip
  • 1 posts
Sorry if this is in the wrong section. I think I'm in the right spot...

My question is: is there a way to have a browser identify a line of code and substitute it with a different line of code?

let's say the page's code is:

<html>

<head>

<title></title>

</head>

<body>


<p>Hello World</p>


</body>

</html>


can i have it identify the "Hello World" and change it to something else like this so the viewers experience of a website is different without changing the site's actual code?

<html>

<head>

<title></title>

</head>

<body>


<p>Good Bye World</p>


</body>

</html>


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
You can write a JavaScript function to do that.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
zeroradius

zeroradius

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,406 posts
You could also use a server side language (or JS as WP said) to perform a
  • switch statement
  • if statement
  • while loop
  • other conditional statements

When do you want this text to change and we can point you in the right direction
Posted Image

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
You could give the <p> and id to make the task easier, and then in the Javascript portion you could write getElementById('someid').innerHTML = "Good Bye World" to change the text, automatically, or by a button or link or etc.

I am sure some simple Javascript tutorials will show you where to place the code and how.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users