So I'm running a parenscript tutorial using the following code:
(defparameter *js-string-delimiter* #\")
(hunchentoot:define-easy-handler (tutorial1 :uri "/tutorial1") ()
(cl-who:with-html-output-to-string (s)
(:html
(:head (:title "Parenscript tutorial, example 1"))
(:body (:h2 "Parenscript totorial: 1st example")
"Please click the link below." :br
(:a :href "#" :onclick (parenscript:ps (alert "Hello World!"))
"Hello World!")))))
The page renders, but the clickable link does not work. When I view the source, I get the following:
<html><head><title>Parenscript tutorial, example 1</title></head><body><h2>Parenscript totorial: 1st example</h2>Please click the link below.<br /><a href='#' onclick='alert('Hello World!');'>Hello World!</a></body></html>
Which does not work. I need the alert function closed in quotes ", not semi-quotes '. What am I doing wrong?
OK, after a bunch of looking around, I found that it appears the tutorial is wrong. Instead of using parenscript:ps to generate the code, you should use parenscript:ps-inline to get the quoting correct.
Hope this helps someone else.
Related
I have never used MailChimp Easy Forms before. I'm trying to make the pop-up apear when a user pressing a button instead of the pop-up to just showing when the user gets to the website.
My js code:
<script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup- forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
<script>
function showMailingPopUp() {
alert('inside the button click');
require(["mojo/signup-forms/Loader"], function (L) {
L.start({
"baseUrl": "mc.us1.list-manage.com", "uuid": "81016de6debaf524b31df317af5480b1-us17",
"lid": "8517f84634"
})
})
document.cookie = "MCEvilPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
}
</script>
And the HTML:
<button id="open-popup" onclick ="showMailingPopUp();">Email signing</button>
In the inspection tool I get this error:
This is how it looks in MailChimp:
Currently i'm using the listid from MailChimp as "lid" and my API-key as "uuid" and I think it's the uuid that break, but what is the uuid? If it's not the id's thats wrong what is it then?
Thanks in advance :-)
Install Easy Forms for MailChimp WordPress Plugin and set the mailchimp API key and it will fetch all of your list now create new form and assign list with it then save it one shortcode will generate.
Now open one pop up using jquery and in content paste the shortcode then it will work.
https://wordpress.org/plugins/yikes-inc-easy-mailchimp-extender/
my question seems to be already ask, but truth me the situation here is diferent.
Problem:
TypeError: this.getDoc(...) is undefined
What i already do:
-update jquery version
-test every parameters pass to the tinymce functions, everything is ok
My code:
var html = '<div class="traduce-fields"><h4></h4><div class="text-block"><textarea class="textarea-tinymce" id="textarea-' + dataLang + '"></textarea></div><div class="bt-valide-traduce" onclick="sendTraduce($(this))"><p>TO TRADUCE !</p></div></div>';
$('.traduce-bloc-text').find('.traduce-inner').html(html);
//active de nouveau tinyMCE
tinymce.init({selector: '.textarea-tinymce'});
var selector = 'textarea-' + dataLang;
tinymce.get(selector).setContent('ok');
As mentioned in my original comment, my bet is that you are trying to use TinyMCE before its fully initialized. There is a function that can tell you when its fully initialized so you can use that to set the content:
tinymce.init({
selector: 'textarea',
...
setup: function (editor) {
editor.on('init', function () {
this.setContent('Using the on init stuff!');
});
}
As it takes you time to click on your alert this is probably allowing for TinyMCE to finish loading hence the setContent() call is then working.
My cod is long and show him in JS fiddle is hard but I got something that could help you:
This code works:
tinymce.init({selector: '.textarea-tinymce'});
alert(tinymce.get(idTextarea));
var tinyMCEInstance = tinymce.get(idTextarea);
tinyMCEInstance.setContent('ok');
This not:
tinymce.init({selector: '.textarea-tinymce'});
/*alert(tinymce.get(idTextarea));*/
var tinyMCEInstance = tinymce.get(idTextarea);
tinyMCEInstance.setContent('ok');
That's very strange, what kind of problem an alert could solve?
Thank you for helping me.
I'm developing a ASP.NET MVC3 website for the 1st time. On my development machine everything works fine.
I bin deployed everything on our test machine. After some missing DLL issues the website seemed to work on the following url:
http://localhost/Test%20Website
But when I clicked the following link (which is created by an inline javascript because I'm using Infragistics Grid which is irrelevant for the question):
<img src=\"../Resources/Edit.png\" align=\"left \">
I get HTTP Error 404.0 - Not Found, which is logical, because the Physical Path is: C:\inetpub\wwwroot\Patient\Edit\537
While the physical Path should be: C:\inetpub\wwwroot\Test Website\Views\Patient\Edit\537 (atleast... I think... don't understand how MVC routing works exactly)
The links which are made by using the ActionLink HTML helper and such work fine by the way.
So this works:
#Html.ActionLink("About", "About", "Home")
And this works:
#Html.Partial("Search", new SearchModel())
So, my question is, how do you solve these issues?
p.s.: All the images in resources don't work either. sigh
UPDATE after an answer
I'm sorry, apparantly it is important to note that this takes place in a javascript function as a string. That's because I'm using the FormatterFunction from Infragistic's JQuery grid. Ok, this is what I've got so far:
"function(val) {return '<img src=\"../Resources/Edit.png\" align=\"left\">'; }"
The name 'val' does not exist in the current context, which is logical. But I don't know how to solve it, 'cause of my limitted knowledge of javascript/Razor/etc... Could you please help? Val in this case is by the way the value of the column it's bound to. In this case the ID of patient.
Ego4eg asked more code
It's Infragistics JQuery grid. This grid has a FormatterFunction which has a string as parameter. This string needs to be a javascript function. To give you an idea, this looks like:
#(Html.Infragistics()
.Grid(Model)
.ID("grid1")
.AutoGenerateColumns(false)
.Columns(column => {
//column.For(p => p.ID).FormatterFunction("function(val) {return '<img src=\"../Resources/Edit.png\" align=\"left\">'; }").Width("25px").HeaderText(" ");
column.For(p => p.ID).FormatterFunction("function(val) {return '<img src=\"../Resources/Edit.png\" align=\"left\">'; }").Width("25px").HeaderText(" ");
column.For(p => p.ID).FormatterFunction("function(val) {return '<img src=\"../Resources/add.png\" align=\"left\">'; }").Width("25px").HeaderText(" ");
column.For(p => p.FullName).DataType("string").HeaderText("Naam").Width("250px");
column.For(p => p.Address).DataType("string").HeaderText("Adres").Width("400px");
column.For(p => p.BSN).DataType("string").HeaderText("BSN").Width("85px");
column.For(p => p.DateOfBirthAsString).DataType("string").HeaderText("Geboortedatum").Width("85px");
column.For(p => p.GeneralPractitionerName).DataType("string").HeaderText("Huisarts");
})
Hope this helps.
It would be better to use Url.Content like:
<a href=\"#Url.Content("~/Patient/Edit/" + val)\">
Try this:
<a href ="Url.Action("Edit", "Patient", new { id = val })" />
I have MySQL database with multiple URL's.
Each URL is displayed in one iframe, so 3 URL's = 3 iframes. I display them like this.
...
$resu = mysql_fetch_array ($consultation);
echo "<iframe src='".$resu['URL']."' onload='load(this)' id='iframe'></iframe>";
...
With this script I'm able to know the URL of the iframe clicked (not exactly, besides it doesn't work in jsFiddle but in my PC yes. (http://jsfiddle.net/7UxHv/)).
<script type='text/javascript'>
$(window).load(function(){
$('iframe#iframe').load(function(){
alert($('#iframe').attr('src'));
});
});
</script>
But really it displays the first database row and not the one clicked.
Anyway to display the one clicked with that script or another form to do this? Thanks.
edit:
Note you are generating multiple elements with the same id.. id should be unique.
This might be why you get only the first row to work.
I think the below code should work:
Html:
<iframe src='.$resu['URL'].' onload='loadIframe(this)' scrolling='no'></iframe>
JS:
window.loadIframe = function(frame) {
alert("Loaded "+$(frame).attr('src'));
}
Try this... change 'src' to 'data-src'... and try the following...
echo "<iframe data-src='".$resu['URL']."' onload='load(this)' id='iframe'></iframe>";
$('#iframe').click(function() {
alert($('#iframe').data('src'));
});
also instead of using onload try using onclick()...
Might work...
I have been asked to extract info by an academic colleague from a website where I need to link the content of a webpage in a table - not too hard with the contents of a text file which is only reacheable (as far as I can tell) by clicking on a javascript link... e.g.
<a id="tk1" href="javascript:__doPostBack('tk1$ContentPlaceHolder1$grid$tk$OpenFileButton','')">
The table is conveniently inside a table with id='tk1' which is nice... but how do I follow the link which pulls the text file.
Ideally I'd like to do this in R... I can grab the relevant table in text format by saying
u <- the url of interest...
library(XML)
tables = readHTMLTable(u)
interestingTable <- tables[grep('tk1', names(tables))]
And this will give the text in the table, but how do I grab the html for that particular table? and how do I "click" on the button and get the text file behind it?
I note that there is a form with massive hidden values - the site appears to be asp.net driven and uses impenetrable URLs.
Many thanks!
This is somewhat tricky, and not fully integrated in R, but some system()-fiddling will get you started.
Download and install phantom javascript: http://code.google.com/p/phantomjs/
Check the short script on http://menne-biomed.de/uni/JavaButton.html, which emulates your case. When you click the javascript anchor, it redirects http://cran.at.r-project.org/ via doPostBack(inaccessibleJavascriptVar).
Save the following script locally as javabutton.js
var page = new WebPage();
page.open('http://www.menne-biomed.de/uni/JavaButton.html', function (status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
var ua = page.evaluate(function () {
var t = document.getElementById('tk1').href;
var re = new RegExp('\((.*)\)');
return eval(re.exec(t)[1]);
});
console.log(ua);// Outputs http://cran.at.r-project.org/
}
phantom.exit();
});
With phantomjs on path, call
phantomjs javabutton.js
The link will be displayed on the console. Use any method to get it into Rcurl.
Not elegant, but maybe someones wraps phantomjs into R one day. In case the link to JaveButton.html should be lost, here it is as code.
<!DOCTYPE html >
<head>
<script>
inaccesibleJavascriptVar = 'http://' + 'cran.at.r-project.org/';
function doPostBack(myref)
{
window.location.href= myref;
return false;
}
</script>
</head>
<body>
<a id="tk1" href="javascript:doPostBack(inaccesibleJavascriptVar)" >Click here</a>
</body>
</html>
Have a look at the RCurl package:
http://www.omegahat.org/RCurl/