WordPress function to show content - javascript

I'm in need of a function to check content from a certain part of the site and print it on the main header.
Any idea of how can i do this? It's a radio website.
What i need to track is the content of each program and print the names on the header every half hour.
Any help is appreciated.

Related

Running javascript from the "userside"

I have one maybe stupid question but my googling skill were not up to the task.
I have some html page that I opet at my work that is php generated. On it 80% of the text is not needed for me so I "made" a javascript code that filters/hides all text I am not interested in. It works just fine but for this to work I must SAVE html document on my computer and insert that javascript code into it so it can make text invisible.
Now I am thinking of improving this because every time I reload web page on my company's server I need to save it on computer and insert javascript code.
Please point me into the direction that can help me do this. Is there any way to run that javascript code over already opened page in FireFox or some other browsers?
Html page that I am changing is mostly tables and I am hiding rows that I do not need, but there aro around 500 rows and I only need 15 or 20.
Thank for all your effort!
One way would be to use a 'bookmarklet'. Those are small javascript snippets, which you can insert into your bookmark bar and then execute by clicking on them.
Drag me to bookmarks for alert
For Example, drag the link in this fiddle into your bookmark bar and it will alert 1 on click.
http://jsfiddle.net/5aAPN/2/
Use CSS instead. If you have a white background make the text white. You can also give visibility: hidden a try.

Simple code to bring up multiple iFrames on one page?

It's been a while since I last did coding, I was just wondering how simple I could make this little idea of mine.
Simply put, I'd like to have 4 input text fields on one page, an example of the label and text field is: http://www.url.com/[ASpecificLink] where the [] denotes Text Fields. Upon filling all the text fields and clicking 'Okay', the next page will list iFrames of the link specified, making it a total of 4 iFrames on one page.
My first question is : How simple could I make this idea? off the bat I thought of using PHP, ideally i'd like to access this on an iPad.
My second question is : Would it be possible, for example, to list specific content in the iFrames. For example, in the link I enter, the only content I would like to show is what is contained within the Table elements of the whole page (this would mean the top banner, navbar and other elements would be excluded)
Thank you very much, and looking forward to some other perspectives on this idea. My approach might not be the most efficient way to go about this, and therefore I'd appreciate some out-of-the-box opinions.
Thank you very much
As for the first question : it is very simple to do, but you should'nt use PHP. This can be done very easily with Javascript :
Create a new IFrame element
Set the "src" property to the content of the text inputs
Append it to the page
The browser will load the pages in the iframes by itself.
As for the second question :
Load the page using AJAX (Javascript)
Get the elements you want from the page with Javascript
Append them to an IFrame's ContentWindow property
No code here, since you seem to be only expecting ideas of implementation options :-)

make div float up

I am trying to make a chat option for users however I only want the chat to show for a certain amount of time, I could do this via PHP and timestamp but I would also like to visually hide it by making the div containing the message to float up until it becomes hidden as an overflow..
I seen a script on the following page:
http://rainbow.arch.scriptmania.com/scripts/bg/float_up.html
It uses images but I'd like to do the same idea with submitted messages (floating chat)
Any help would be appreciated
i dont know if this is what you are trying to do: http://jsfiddle.net/LPc2z/3/ ?
its kept simple because i dont know exactly what you are trying to do.

Adding dynamic content to Jquery slider

I want to add dynamic contents to the slides of my jquery slider. the dynamic contents are selected by user through select boxes. The problem is when I add dynamic content it is shown in the div of slider but as soon as I click on Next or Prev that content is lost:(
Please tell me how to store that information on the slider page, so that it won't get lost.
Thanks..
I do this sort of thing all the time. Put the slider on a separate page with all its logic (ie reading the the slides etc from a table). Make it entirely self contained. You can either pass some variables from your user selection or set a session variable that controls the dynamic retrieval.
In your main page call this page with JQuery, something like
$(document).ready(function() {
$('#mysliderdiv').load("whateverthepagewiththeslideriscalled");
});
You can put logic on the boxes to change the session variables. If you are using php for example in the onclick you could use AJAX to pass the selection to a php template which will change the session variable. It will of course be invisible to the user.
As the slider page is loaded by AJAX every time a page is loaded it will be correct.
Sounds a bit long winded but I have done this many times and it works fine.

Refresh a Block content when the page refreshes using javascript

I Just wanna change the content of my block when the page refreshes(Just like the concept in advertisement block changes on page refresh).I'm doing a drupal7 site.That block is a dynamic one (views:block) it has four fields of three text and one image field.
The block's content belongs to a content type "X".On the page refresh the block should show one of content of content type "X".
I want to change the content of the block whenever the page refresh takes place.
Could you please give me the guidance for the script?
Again I don't thank you need a script for this. I guess we can do this by setting the "Items per page" in view to 1 and and in sort criteria select "Global: Random". This should randomize the display of content in the block on every page refresh.

Categories

Resources