Displaying Content Based On Visitor Behavior Using Web Service
Aug 28, 2009
I'm using javascript in addition to a web service (BTBuckets) to display different content to visitors based on actions they take on my site. The javascript is working fine, but I noticed that if I simulate BTBuckets being disabled using Firefox Adblock none of the content shows up. So in the off chance of the service going offline it'll leave some pretty funky holes in the my content. I tried <noscript> tags which works with javascript off, but the content is still blank when I disable BTBuckets. I'm wondering if there's a way to display the default content if the service is unavailable?
Here's the code I'm using:
In the head:
<script type="text/javascript">
//<![CDATA[[
$BTB={s:XXXXX};
$BTB.jsh="[URL]";
//]]>
</script>
<script type="text/javascript">
document.write(unescape("%3Cscript src='" + $BTB.jsh.replace(/(https?:)/i,document.location.protocol) + "' type='text/javascript'%3E%3C/script%3E"));
</script>
The code in the body used to replace an image depending on visitor behavior:
<script type="text/javascript">
var _t = "";
if ($BTB.clusters["ppc_visitors"]) {
_t = ""images/top-photo-tracking-number.jpg" alt="Call Toll-Free: 1-800-XXX-XXXX">";
} else {
_t = ""images/top-photo.jpg" alt="Call Toll-Free: 1-800-XXX-XXXX">";
}
document.write('<img src= ' + _t );
</script>
<noscript><img src="images/top-photo.jpg" alt="Call
Toll-Free: 1-800-XXX-XXXX"></noscript>
View 2 Replies
ADVERTISEMENT
Aug 13, 2010
I have a site that can be downloaded and run on a closed network (not needing an active Internet connection). I'd like a page that displays live data to a user with Internet connectivity (I can do this) but display "canned" data when the user is without an internet connection...and this difference in page display is transparent to the user. I know this can be done with php but the user without Internet connectivity will likely not be able to run php locally so the page must be an .htm file. I there a javascript somewhere that does this?
View 1 Replies
View Related
Jun 14, 2005
How do I display a section of my site that would say something like:
"Welcome from [city, state]!"
Using their IP address, I gather, but how?
View 1 Replies
View Related
Jan 15, 2011
ok, here's the background on my "lets learn jquery" debacle ... I have downloaded it (plus the UI) and that demo index.html loads and functions perfectly.
well, I can create a brand new .html document, and include just the jquery.js and perform something, and it will work ... here's the thing, if I change *anything* in the source file, the content in firefox will not refresh ... I could even delete random tags, including the <body> tags, the <h1> tags and text ... and it will just not carry over to the browser. And, if I view the source on firefox it will show a random amount of lines removed from the bottom of the .html file
what in the world is happening ... it is driving me crazy that i cant figure this out. (btw i'm using jquery1.4.4 on centos5.4 + apache2.3.3, and firefox3.6.6 from win7 if it matters)
to recap, if i start with a blank/fresh/from scratch file it will work as designed ... but as soon as I change anything, adding or removing code/content, it blows up randomly displaying content (even old content that isnt even saved in the .html file anymore!)
View 1 Replies
View Related
Dec 5, 2009
I'm trying to write a simple javascript and am having some difficulties. The purpose of the script is to send an xml document to the service. The response is not important.
I'm getting this error: "HTTP Is Not Defined"
Code:
View 4 Replies
View Related
Jul 24, 2010
What I want to do is have a page that only displays if javascript is enabled(or similar) in the sense that it tells users that js is not enabled and how to enable, what were doing is creating web forms and would only like them viewable if js is enabled so that we can validate client side and reduce server load. Main reason is validation client side, cause if the initial form works well we will expand it to include forms for every type of job we can. No idea to where to start as js is not a strong point.
View 3 Replies
View Related
Mar 11, 2010
I have a page where I need to display 1 of 5 divs, based on the radio button that's selected. The code I'm using is from a previous page that basically did the same thing, only the user had to click on a tab, which would in turn change the style on the div from "display: none" to "". I'm assuming I can basically use the same code, but I'm not sure how to do this with radio buttons. The page I'm working with is at [URL].
Here is the code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css"> .....
View 13 Replies
View Related
Dec 30, 2010
I am trying to display three different types of forms of the same page. One of the three will appear based on the selection. Right now my code has everything shown when you first reload the page and then when you select something it all disappears and nothing comes back. I am trying to use divs because the forms will perform the same action just with different parameters. It is a lot of code but the forms are the same thing just wrapped in a different div and I know they work. hopefully this will cut down on the amount of time you have to look at it.
Below is what I have so far:
Code:
<html>
<head>
<script type="text/javascript" language="javascript">
function choose()
{
document.getElementById('notes').style.display = 'none';
document.getElementById('tests').style.display = 'none';
document.getElementById('homework').style.display = 'none'; .....
View 2 Replies
View Related
Mar 13, 2006
I have a form with a drop down list box, few textboxes with labels and submit button. depending upon my selection I should be able to show hide textbox; assume items, 1,3,5 in the selection box shows the items other than the listbox and 2,4,6 items in the selction box if selected hides the labels and textboxes. but in all the case submit button should be present.
View 6 Replies
View Related
Sep 24, 2009
You've all seen it before banner codes/rss feed displayers/twitter feeds/etc. All you do is copy and paste a <script src="[URL]"></script> somewhere on your website and it retrieves the html from the remote server and displays it on your site. I have a back end php page that pulls the required information from my DB based off a userid passed to it i.e.:
mywebserver.com/display.php?id=xxxx
Is the javascript just a simple ajax call to my php page passing straight on the userid passed to it or is there something more complex to it? I was always under the impression you couldn't do remote ajax calls to a page on a different server, which if I get this right a script off my server included on another domain becomes a member script of that domain and not my own?
View 17 Replies
View Related
Feb 7, 2007
I have content inside a DIV that I want to display only the first time the page is viewed. I'm assuming this can be done with a cookie and javascript with little difficulty.
So basically it needs to write the cookie and the code for the DIV on the first load and then anytime that person returns to the page, the source for the div is omitted.
I've been researching this for a while but just am not getting anywhere.
View 1 Replies
View Related
Jan 4, 2011
get the information selected from the drop down boxes in my form to display in a pop up. The text field and text area information diplays fine. Can anyone tell me why this isnt working?
JavaScript....
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function displayHTML(form) {
[code]....
View 2 Replies
View Related
Oct 19, 2008
I'm fairly new to JQuery and am trying to get my menus to load all the images before it tries to fade in. I am passing categoryid to an external php page which gets the relevant data from the database, and then displays it in the right div element.
[Code]...
View 2 Replies
View Related
Apr 19, 2011
basically I have the following code:
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display ='block'">View Availability</a>
This pops up a divs with a black alpha background, so that it appears the new content is displaying over the top of the current content. This all works fine, however the content I am displaying in the top level div is (or should be) dynamic.In order for the content to be useful I need to grab the id.Normally I would simply do this:
<a href = "url.php?uniqueidentifier=<?php echo $row['id'];?>" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display ='block'">View Availability</a>
However what happens in this instance is that the page loads with the javascript and the id in the url but it then disappears...
View 14 Replies
View Related
Jun 24, 2009
I'd like to put a script on the home page of one of my sites that automatically rotates content for a specific day of the week.
You can see the site HERE.
I'd like to take the first story in the NEWS & EVENTS section and make it change with each day of the week to match the corresponding stories in THIS PAGE.
I'd like to do this all with Javascript rather than server-side includes. Unfortunately, I know very little Javascript.
View 6 Replies
View Related
Nov 13, 2009
I have a simple script for showing my content (pictures) on other websites, but it generates the content by reading the users date (1-31), and because of that can show only certain amount of content/pictures (31) on a mountly bases. Can I edit this simple script to randomize the way the content is being displayed, so I'll be able to display a greater number of content? Example of the way the content is displayed: [URL]
Code that displays the script:
Code:
<script language="JavaScript" src="[URL]"></script>
Script:
Code:
var msg = new Array();
Stamp = new Date();
today = Stamp.getDate(); .....
function writeTip() {
document.write(msg[today]);
}
document.write(msg[today]);
document.write('<br>[<a <a target=_blank href="[URL]</a>]');
View 1 Replies
View Related
Mar 19, 2009
displaying content from array into textarea
View 4 Replies
View Related
Apr 21, 2010
1) I have a series of divs embedded into a page, sort of like an FAQ setup. Each has a unique id like id="service1" etc.
2) i'm using an unordered list with each li being a hyperlink to the div id's
3) the div's are set up as name anchors ( <a name="service1">Service One</a. ) so I can hyperlink to them via the <a href="#service1">Service One</a> method
4) There's 22 divs and they need to be hidden until summoned. Therefore, I set $('.service').hide(); to make them all disappear.
Now, where i'm stuck is in how to summon them individually and have them appear when the appropriate list hyperlink is clicked. I'm using:
$('.servicelist a').click(function() {
var toLoad = $(this).attr('href');
}
So it's telling it to load the info found at the appropriate link. This is where i'm stuck. I need help on
1) how to 'unhide' the proper div id containing the related data
2) how to point it to the right location in the page (target div)
View 4 Replies
View Related
Sep 28, 2010
I have enabled a hover() event on a DIV that includes an H2 element that is always displayed and a child DIV that needs to be shown/hidden. This code works wonderfully on Firefox and IE. However, it's not working in Safari (I have not tested Opera or Chrome yet)Here's my (very simple) code:
jQuery("div.category-text").css("display","none");
jQuery("div.category-item").hover(
function() {
[code].....
View 1 Replies
View Related
Oct 27, 2011
I'm new here and I have tried to search the forum, but there was nothing fitting to my problem.
I would like to display content in an alert box. Sounds simple, but the content is fetched immediately, so I have no influence on that[code]...
This responseText is quite long and I need to display it in more than 2 lines.
Im doing some security research for my master thesis and am a JacaScript newbie
View 6 Replies
View Related
Feb 15, 2009
I'm new to javascript and still trying to learn my way around. Below is my code
<script type ="text/javascript">
var a1 = "2";
var t2 = "hello world";
var total = ("t" + a1);
alert(total);
</script>
That code will display the string "t2" rather than the value of the variable t2. How do I make javascript display the value of the variable rather than the string?
View 5 Replies
View Related
Jan 26, 2011
I'm using the script below in a custom HTML to generate a random line of text (not with the text shown here). This works fine BUT; I want it to go randomly through the WHOLE list without repeating lines that already have been printed. As it is now, a line of text might be printed several times in a row, which is a little annoying. I'm using a refresh button for generating a new line of text.
How can I just make it display in the order shown and just re-arrange the content so it seems random to the user? Random would the best though...
<script language="JavaScript">
<!--
var r_text = new Array ();
r_text[0] = "All the leaves are brown";
[Code]....
View 6 Replies
View Related
Oct 23, 2005
The content of my webpage is all contained in hidden divs. These divs are shown when a link in the nav bar is clicked. At the moment, ALL divs are hidden on page load, only the nav bar is visible. Is there a way to have one of the divs visable when the page loads? i.e the 'home' page.
function init(){
if(document.getElementById && document.createTextNode){
var mn=document.getElementById('nav');
var as=mn.getElementsByTagName('a');
for (var i=0;i<as.length;i++){
as[i]. false}
as[i]. false}
}
hidem();
}}
function show(l){
hidem();
var id=l.href.match(/#(w.+)/)[1];
document.getElementById(id).style.display='block'
}
function hidem(){
for (var i=0;i<document.getElementsByTagName('div').length;i++){
document.getElementsByTagName('div')[i].style.display='none'
}}
The function init() is called on page load.
View 4 Replies
View Related
Oct 5, 2011
I have successfully loaded an element of content from another section of our website on a page, but for some reason it is firing .load() twice and displaying the section of content twice, stacked on top of each other.
<script type="text/javascript" src="/js/jquery.162.min.js"></script>
<script type="text/javascript">
$(function() {
$('#site_navigation').load('/store/ .menu_div', function() {
[Code]....
View 2 Replies
View Related
May 4, 2010
i have managed to make things work how i wanted quite quickly but to be honest jQuery is so easy that i'm not sure i completely understood what i was doing .. but it's working anyways ... well almost ...I have an empty div into which i load HTML content from another page. When i click a link on the page, the content from the other page should load and then the div should change background color and then be displayed with a fade animation. When i click on another link, the displayed content should fade out and the new content fade in.Everything works more or less only that when i switch from one loaded content to another, i can briefly see the old content before the new one is displayed, so the DIV fades out, then fades in again with the old content loaded and then only the new content switches in.I think probably i have my code wrong, could someone have a look ?
$(document).ready(function() {
var href = $('.bodytext a').each(function(){
var href = $(this).attr('href');
[code]....
View 2 Replies
View Related
May 4, 2010
I'm making a quick and dirty Google Calendar displayer with help from Full Calendar and am struggling to display the details of each Google event correctly. As you may know, if you're not logged into Google Calendar, if you're given an event link or invitation you will be taken to a dynamically generated page displaying the basic details of that event. It includes a <link> ed stylesheet and inline style="..." for each element. I have attached a screenshot of a typical event page.
I'm trying to strip out all the style and just display the content:
eventClick: function(event) {
if (event.url) {
$("#details").hide().load(event.url);
$("#details *").each(function(){
[Code].....
View 7 Replies
View Related