My website works fine and all javascript files also work in my computer, but after publishing to the server all files work except super.js file. Links in menu supposed to work but it shows just "#".
<script type="text/javascript" src="/App_Themes/standart2/js/jquery.min.js"></script>
<script type="text/javascript" src="/App_Themes/standart2/js/bootstrap.min.js"></script>
**<script type="text/javascript" src="/App_Themes/standart2/js/super.js"></script>**
<script type="text/javascript" src="/newfiles/calendar/js/jquery-ui.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.easing-1.3.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.easing.compatibility.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.jcarousellite.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.jcarousellite.min.js"></script>
<script type="text/javascript" src="/newfiles/slider/script/jquery.mousewheel-3.1.12.js"></script>
Here is a snippet code to my file [a link] (http://jsfiddle.net/programmer777/oxj69tum/embedded/result/)! i don't understand a problem, looked everywhere, but couldn't find a solution.
$(document).ready(function () {
var menuLinksNew = $(".menuH>li>a");
var pathname = $(location).attr('pathname');
if (pathname.substring(1, 3) == "eng") {
$(menuLinksNew[0]).attr("href", "/about");
$(menuLinksNew[0]).text("About");
}
else if (pathname.substring(1, 3) == "fr") {
$(menuLinksNew[0]).attr("href", "/about");
$(menuLinksNew[0]).text('About');
}
var submenuNew1 = $(".menuH ul a");
if (pathname.substring(1, 3) == "eng") {
$(submenuNew1[0]).attr("href", "/eng/about/info");
$(submenuNew1[0]).children("h5").text("blah");
$(submenuNew1[1]).attr("href", "/eng/about/info/1");
$(submenuNew1[1]).children("h5").text("blah");
$(submenuNew1[2]).attr("href", "/eng/about/info");
$(submenuNew1[2]).children("small").text('blah');
$(submenuNew1[3]).attr("href", "/eng/about/info");
$(submenuNew1[3]).children("small").text('blah');
}
else if (pathname.substring(1, 3) == "fr") {
$(submenuNew1[0]).attr("href", "/fr/about/info");
$(submenuNew1[0]).children("h5").text("blah");
$(submenuNew1[1]).attr("href", "/fr/about/info/1");
$(submenuNew1[1]).children("h5").text("blah");
$(submenuNew1[2]).attr("href", "/fr/about/info");
$(submenuNew1[2]).children("small").text('blah');
$(submenuNew1[3]).attr("href", "/fr/about/info");
$(submenuNew1[3]).children("small").text('blah');
});
if (pathname.substring(1, 3) == "eng") {
$(submenuNew1[0]).attr("href", "/eng/about/info");
$(submenuNew1[0]).children("h5").text("blah");
$(submenuNew1[1]).attr("href", "/eng/about/info/1");
$(submenuNew1[1]).children("h5").text("blah");
$(submenuNew1[2]).attr("href", "/eng/about/info");
$(submenuNew1[2]).children("small").text('blah');
$(submenuNew1[3]).attr("href", "/eng/about/info");
$(submenuNew1[3]).children("small").text('blah');
**}**
else if (pathname.substring(1, 3) == "fr") {
The brace after before else if is missing.
Related
Here is the HTML head:
<head>
<link type='text/css' rel='stylesheet' href='style.css'>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" href='script.js'></script>
</head>
Here are the contents of the jQuery file:
$(document).ready(function() {
var $block_number = prompt('How many blocks?');
function writeBoard() {
while ($.isNumeric($block_number) === false && $block_number < 150) {
$block_number = prompt('How many blocks?');
}
for (var i = 0; i < $block_number; i++) {
$('#board').prepend("<div class='block'></div>");
}
};
writeBoard();
$(".block").on("mouseover", function () {
$(this).css("background-color", "black");
});
$('#redo').on('click', function () {
$('.block').css('background-color', 'white');
$block_number = prompt('How many blocks?');
writeBoard();
});
});
It doesn't seem to be working when the page is loaded locally as it was on jsfiddle for some reason. Any thoughts?
Fiddle: http://jsfiddle.net/zfiscr/9dutj67b/
Your script tag should be as follows :
<script type="text/javascript" src="script.js"></script>
instead of
<script type="text/javascript" href="script.js"></script>
Hope that helps!!!
Script has src , CSS has href :)
<script type="text/javascript" src='script.js'></script>
is correct.
Why ? Please check Here
when i try to use javascript to start the unity webplayer inside a xhtml-file the webpage cant detect the webplayer and asks me to download it.
Same source(generated by unity itself) with .html works fine
why? :O
<script type='text/javascript' src='https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/jquery.min.js'></script>
<script type="text/javascript">
<!--
var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js";
if (document.location.protocol == 'https:')
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
-->
</script>
<script type="text/javascript">
<!--
var config = {
width: 512,
height: 260,
params: { enableDebugging:"0" }
};
var u = new UnityObject2(config);
jQuery(function() {
var $missingScreen = jQuery("#unityPlayer").find(".missing");
var $brokenScreen = jQuery("#unityPlayer").find(".broken");
$missingScreen.hide();
$brokenScreen.hide();
u.observeProgress(function (progress) {
switch(progress.pluginStatus) {
case "broken":
$brokenScreen.find("a").click(function (e) {
e.stopPropagation();
e.preventDefault();
u.installPlugin();
return false;
});
$brokenScreen.show();
break;
case "missing":
$missingScreen.find("a").click(function (e) {
e.stopPropagation();
e.preventDefault();
u.installPlugin();
return false;
});
$missingScreen.show();
break;
case "installed":
$missingScreen.remove();
break;
case "first":
break;
}
});
u.initPlugin(jQuery("#unityPlayer")[0], "BulletImages.unity3d");
});
-->
</script>
<div id="unityPlayer">
<div class="missing">
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
</a>
</div>
</div>
JavaScript isn't allowed to use document.write() on XHTML pages.
Note the offending snippet:
<script type="text/javascript">
<!--
var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js";
if (document.location.protocol == 'https:')
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
-->
</script>
You may notice the script in question is performing a very simple operation. If you know your deployment, you can strip it and include the result plainly:
If deploying to HTTP website:
<script type="text/javascript" src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"></script>
If deploying to HTTPS website:
<script type="text/javascript" src="https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"></script>
If you're not sure, an ideal fix would be to edit the page's DOM, but a quick and dirty workaround is to edit a node's innerHTML directly.
I have a simple page with a "button/link" when i press the button i need to call the github api to return all issues logged in my repository and show in table format.
But when i hit the link nothing happends..
<html>
<head>
<script src="json-to-table.js"></script>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="script.js"></script>
<script src="script.responsive.js"></script>
</head>
<body>
<h2>All Issues</h2>
VIEW
<div id="ghapidata" class="clearfix">
<script type="text/javascript">
$(function() {
$('#ghsubmitbtn').on('click', function(e) {
e.preventDefault();
$('#ghapidata').html('<div id="loader"><img src="css/loader.gif" alt="loader..."></div>');
var ghissues = 'https://api.github.com/repos/stroes/stroestest/issues';
requestJson(ghissues, function(json) {
if(json.message == "Not Found") {
$('#ghapidata').html("<h2>No Issues found in this repository</h2>");
}
else {
var jsonHtmlTable = ConvertJsonToTable(ghissues, 'jsonTable', null, 'Download');
}
}
}
});
</script>
</div>
</body>
</html>
Can anyone point me to where i have gone wrong with my code
your script is inside your div tag. When you change the html inside it, whole script will be removed. Try to place the script outside the div tag.
<html>
<head>
<script src="json-to-table.js"></script>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="script.js"></script>
<script src="script.responsive.js"></script>
</head>
<body>
<h2>All Issues</h2>
VIEW
<div id="ghapidata" class="clearfix"></div>
<script type="text/javascript">
$(function() {
$('#ghsubmitbtn').on('click', function(e) {
e.preventDefault();
$('#ghapidata').html('<div id="loader"><img src="css/loader.gif" alt="loader..."></div>');
var ghissues = 'https://api.github.com/repos/stroes/stroestest/issues';
requestJson(ghissues, function(json) {
if(json.message == "Not Found") {
$('#ghapidata').html("<h2>No Issues found in this repository</h2>");
}
else {
var jsonHtmlTable = ConvertJsonToTable(ghissues, 'jsonTable', null, 'Download');
}
}
}
});
You should see errors in your console. You didn't close the functions right
$(function () {
$('#ghsubmitbtn').on('click', function (e) {
e.preventDefault();
$('#ghapidata').html('<div id="loader"><img src="css/loader.gif" alt="loader..."></div>');
var ghissues = 'https://api.github.com/repos/stroes/stroestest/issues';
requestJson(ghissues, function (json) {
if (json.message == "Not Found") {
$('#ghapidata').html("<h2>No Issues found in this repository</h2>");
} else {
var jsonHtmlTable = ConvertJsonToTable(ghissues, 'jsonTable', null, 'Download');
}
});
});
});
please look here again
var jsonHtmlTable = ConvertJsonToTable(ghissues, 'jsonTable', null, 'Download');
The second parameter requires id of your table you have no table with id jsonTable i think that is the problem
I created an HTML documentation with the help of HelpNDoc personal edition http://www.helpndoc.com/
I have used a default template provided with it the template loads well in almost all the browsers except for the google chrome , the template does not load , since i am not so advanced in HTML i thought you could give some help.
Errors:
Unsafe JavaScript attempt to access frame with URL file:///C:/Users/lenovo
/Documents /HelpNDoc/Output/html/testingproject.html from frame with URL
file:///C:/Users/lenovo/Documents/HelpNDoc/Output/html/toc.html. Domains,
protocols and ports must match.
toc.html:36
Uncaught TypeError: Cannot call method 'lastIndexOf' of undefined toc.html:36
Unsafe JavaScript attempt to access frame with URL file:///C:/Users/lenovo
/Documents/HelpNDoc/Output/html/toc.html from frame with URL file:///C:/Users
/lenovo/Documents/HelpNDoc/Output/html/Introduction.html. Domains, protocols and
ports must match.
Introduction.html:27
Unsafe JavaScript attempt to access frame with URL file:///C:/Users/lenovo
/Documents/HelpNDoc/Output/html/toc.html from frame with URL file:///C:/Users
/lenovo/Documents/HelpNDoc/Output/html/Systemrequirements.html. Domains,
protocols and ports must match.
Systemrequirements.html:27
Unsafe JavaScript attempt to access frame with URL file:///C:/Users/lenovo
/Documents/HelpNDoc/Output/html/toc.html from frame with URL file:///C:/Users/lenovo
/Documents/HelpNDoc/Output/html/Gettinghelp.html. Domains, protocols and ports
must match.
Gettinghelp.html:27
toc.html looks like-i am adding contents before line 36 and after it
<script type="text/javascript" src="js/searchdata.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery.dynatree.min.js"></script>
<script type="text/javascript" src="js/hndjsse.js"></script>
<script type="text/javascript">
var bSearchDataLoaded = true;
var sHelpIdToActivate = '';
$(document).ready(function()
{
var sAnchorName =
top.location.href.substring(top.location.href.lastIndexOf("#") + 1,
top.location.href.length);
var nSelectedTab = 0;
if (sAnchorName == '_index') nSelectedTab = 1
else if (sAnchorName == '_search') nSelectedTab =
2;
$("#tabs").tabs({
selected: nSelectedTab,
select: function(event, ui) { HideKwPopup(); }
});
// Toc
$("#tab-toc").dynatree({
clickFolderMode: 1,
debugLevel: 0,
imagePath: 'css/dynatree/chm/',
onActivate: function(node){
if ($("#tab-keywords") && $("#tab-
keywords").dynatree && $("#tab-keywords").dynatree("getTree") && $("#tab-
keywords").dynatree("getTree").activateKey)
$("#tab-
keywords").dynatree("getTree").activateKey(null);
if(node.data.href && node.data.href != '#'){
window.open(node.data.href,
node.data.target);
}
}
});
introduction.html looks like-i have added lines before and after line 27
</style>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/hnd.js"></script>
<script type="text/javascript"><!--
if (top.frames.length == 0)
{
var sTopicUrl =
top.location.href.substring(top.location.href.lastIndexOf("/") + 1,
top.location.href.length);
top.location.href = "testingproject.html?" + sTopicUrl;
}
else if (top && top.FrameTOC && top.FrameTOC.SelectTocItem)
{
top.FrameTOC.SelectTocItem("Introduction");
}
</script>
</head>
system requirements.html looks like
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/hnd.js"></script>
<script type="text/javascript"><!--
if (top.frames.length == 0)
{
var sTopicUrl =
top.location.href.substring(top.location.href.lastIndexOf("/") + 1,
top.location.href.length);
top.location.href = "testingproject.html?" + sTopicUrl;
}
else if (top && top.FrameTOC && top.FrameTOC.SelectTocItem)
{
top.FrameTOC.SelectTocItem("Systemrequirements");
}
</script>
</head>
gettinghelp.html looks like -
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/hnd.js"></script>
<script type="text/javascript"><!--
if (top.frames.length == 0)
{
var sTopicUrl =
top.location.href.substring(top.location.href.lastIndexOf("/") + 1,
top.location.href.length);
top.location.href = "testingproject.html?" + sTopicUrl;
}
else if (top && top.FrameTOC && top.FrameTOC.SelectTocItem)
{
top.FrameTOC.SelectTocItem("Gettinghelp");
}
</script>
</head>
Any help is highly appreciated.
Thanks
Eddie
This is just toc.html, but I'm intressted if this solves the problem for that file:
<script type="text/javascript" src="js/searchdata.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/jquery.dynatree.min.js"></script>
<script type="text/javascript" src="js/hndjsse.js"></script>
<script type="text/javascript">
var bSearchDataLoaded = true;
var sHelpIdToActivate = '';
$(document).ready(function()
{
var sAnchorName =
top.location.href.substring(top.location.href.lastIndexOf("#") + 1,
top.location.href.length);
var nSelectedTab = 0;
if (sAnchorName == '_index'){
nSelectedTab = 1
}
else if (sAnchorName == '_search'){
nSelectedTab = 2;
$("#tabs").tabs({
selected: nSelectedTab,
select: function(event, ui) { HideKwPopup(); }
});
}
// Toc
$("#tab-toc").dynatree({
clickFolderMode: 1,
debugLevel: 0,
imagePath: 'css/dynatree/chm/',
onActivate: function(node){
if ($("#tab-keywords") && $("#tab-keywords").dynatree && $("#tab-keywords").dynatree("getTree") && $("#tab-keywords").dynatree("getTree").activateKey){
$("#tab-keywords").dynatree("getTree").activateKey(null);
if(node.data.href && node.data.href != '#'){
window.open(node.data.href, node.data.target);
}
}
}
});
});
If this works, it was just a case of missing out a bracket somewhere ... If not it is probably a deeper problem which I can't help with :)
Hope this helps
This problem is due to security restrictions of Google Chrome when some JavaScript is launched locally. This won't happen when the documentation is uploaded on a web-server. This is explained here: http://www.helpndoc.com/sites/default/files/documentation/html/index.html?GoogleChromeshowsanerrorwhensear.html
Also #powtac is right, this is a duplicate for: Unsafe JavaScript attempt to access frame with URL
i have this code for a datetime picker
<link type="text/css" href="css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="js/timepicker.js"></script>
<script type="text/javascript">
$(function() {
$('#datetime').datepicker({
duration: '',
showTime: true,
constrainInput: false
});
});
</script>
i also have this code for a dialog box that shows when a field is empty.
<link type="text/css" href="jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="ui/ui.core.js"></script>
<script type="text/javascript" src="ui/ui.draggable.js"></script>
<script type="text/javascript" src="ui/ui.resizable.js"></script>
<script type="text/javascript" src="ui/ui.dialog.js"></script>
<script type="text/javascript" src="external/bgiframe/jquery.bgiframe.js"></script>
<script type="text/javascript">
function haha(form) {
if(document.getElementById('in').checked || document.getElementById('off').checked) {
if(form.title.value=='' || form.nature.value=='' || form.start_date.value=='' || form.end_date.value=='' || form.hour1.value=='' || form.min1.value=='' || form.ampm1.value=='' || form.hour2.value=='' || form.min2.value=='' || form.ampm2.value=='' || form.venue.value=='' || form.rationale.value=='' || form.objectives.value=='' || form.description.value=='' || form.target.value=='' || form.monitoring.value=='') {
hello();
return false;
}
else{
return true;
}
}
else {
hello();
return false;
}
}
$(function() {
$("#dialog2").dialog({
autoOpen: false,
bgiframe: true,
modal: true,
resizable: false,
draggable: false,
height:160,
width:260,
buttons: {
Ok: function() {
$(this).dialog('close');
}
}
});
});
function hello() {
$("#dialog2").dialog('open');
}
function getElem(id) {
return document.all ? document.all(id) :
document.getElementById ? document.getElementById(id) :
document.layers ? document.layers[id] :
null;
}
function printToPage(id,content,classname) {
var el = getElem(id);
if (!el) return;
if (el.style) {
el.innerHTML = content;
if (classname) el.className = classname;
}
else if (el.document) {
var SPANstr = (classname) ? '<span class="' + classname + '">' : '<span>';
el.document.write('haha');
el.document.close();
}
}
</script>
the problem is i can't seem to make them work together? how can i make multiple scripts to work in a single page?
Assuming your
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
line is built specifically for the Datepicker, and doesn't already include the dialog framework in it, include it after the
<script type="text/javascript" src="ui/ui.core.js"></script>
<script type="text/javascript" src="ui/ui.draggable.js"></script>
<script type="text/javascript" src="ui/ui.resizable.js"></script>
<script type="text/javascript" src="ui/ui.dialog.js"></script>
<script type="text/javascript" src="external/bgiframe/jquery.bgiframe.js"></script>
lines.
Then change your
$(function() {
$("#dialog2").dialog({...});
}
method to look like this
$(function() {
$("#dialog2").dialog({...});
$('#datetime').datepicker({...});
}
Without knowing what your actual markup looks like, this should work.